Using REST API - Move Catalogs

The move catalogs API ({your_mart_url}/MartServer/api/catalog/move) endpoint enables you to move a catalogs (Library, Model, or Template) to a different container (Mart or Library) using API Access Token authentication.

To move catalogs, ensure that you have:

  • View permissions on the model hierarchy
  • Delete permissions at the source location (current container)
  • Create permissions at the target location (new container)

Endpoint Information

Property Value
Method POST
URL /MartServer/api/catalog/move
Authentication Required (Bearer Token)
Content-Type application/json

Moving Catalogs

Step 1: Create a New Request

  1. Open Postman and click New > HTTP Request.

  2. Set the method to POST.

  3. Enter the URL: https://<your-server-host>:<port>/MartServer/api/catalog/move.

    Example: https://localhost:8443/MartServer/api/catalog/move

Step 2: Configure Authentication

  1. Generate an API Access Token from the Mart Portal:.

    1. Navigate to Settings > API Access Tokens.

    2. Create a new token or copy an existing one.

  2. Go to the Authorization tab.

  3. Select Bearer Token as the type.

  4. Paste the API Access Token into the Token field.

Step 3: Configure the Request Body

  1. Go to the Body tab

  2. Select raw and choose JSON from the dropdown

  3. Enter the request payload:

    For example:

    {
    "id": 42,
    "newOwnerId": 10
    }

Request Parameters

The request body must be a JSON object containing the following fields:

Parameter Type Required Constraints Description
id Integer Yes Positive integer; must reference an existing catalog of type Library (L), Model (D), or Template (T) The catalog ID (C_Id) of the item to move
newOwnerId Integer Yes Positive integer; must reference an existing Mart (M) or Library (L) The catalog ID (C_Id) of the target container

Step 4: Send the Request

Click Send. The response will be a JSON object indicating success or failure.

Response Reference

Success Response (HTTP 200)

{
"success": true,
"message": "Catalog moved successfully",
"data": 
{
"catalogId": 42
}
}

Error Responses

HTTP Code Error Scenario Example Response
400 Invalid id parameter {"success": false, "message": "id must be a positive integer"}
400 Invalid newOwnerId parameter {"success": false, "message": "newOwnerId must be a positive integer"}
400 Invalid catalog type (not L, D, or T) {"success": false, "message": "The catalog type must be Library (L), Model (D), or Template (T)"}
400 Invalid target type (not M or L) {"success": false, "message": "Target container must be a Mart (M) or Library (L)"}
400 Catalog already in target container {"success": false, "message": "The catalog is already in the specified target container"}
401 Missing authentication token {"success": false, "message": "Missing authentication token"}
401 Invalid authentication token {"success": false, "message": "Invalid authentication token"}
403 User lacks permission to move catalog {"success": false, "message": "User does not have permission to move this catalog"}
403 Missing required permissions at source or target {"success": false, "message": "Authorization check failed: User \"tom\" does not have required \"Create\" permission on \"Library\". Please contact the Mart Administrator for required permission."}
404 Catalog with specifiedidnot found {"success": false, "message": "Catalog with id 42 not found"}
404 Target container not found {"success": false, "message": "Target container with newOwnerId 10 not found"}
409 Concurrent move operation in progress {"success": false, "message": "A move operation is already in progress for this catalog"}
500 Internal server error {"success": false, "message": "Failed to move catalog"}

Quick Test Workflow

  1. Identify a catalog to move:

    1. Query your Mart database:

      SELECT C_Id, C_Type, C_Container_Id FROM m9Catalog WHERE C_Type IN ('L','D','T')
    2. Pick a catalog C_Id (this becomes your id value).

  2. Identify a valid target container:

    1. Query:

      SELECT C_Id, C_Type FROM m9Catalog WHERE C_Type IN ('M','L')
    2. Pick a container C_Id that is different from the catalog's current C_Container_Id (this becomes your newOwnerId value).

  3. Send the request and verify the response is 200 OK with "success": true.

  4. Verify the move:

    1. Check the database:

      SELECT C_Container_Id FROM m9Catalog WHERE C_Id = <your_id>
    2. The C_Container_Id should now equal your newOwnerId value.

      Or verify in the Mart Portal UI that the catalog is now under the new container.

Notes:

  • The endpoint prevents concurrent moves of the same catalog. If two users try to move the same catalog simultaneously, one will receive a 409 Conflict response.

  • The user must have appropriate permissions: view permissions on the model hierarchy, delete permissions at the source location, and create permissions at the target location.

  • Only catalogs of type Library (L), Model (D), or Template (T) can be moved.

  • Only Mart (M) or Library (L) containers are valid move targets.